﻿using SIPSDk.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace SIPSDk
{
    public static class UserSIPConfig
    {
        private static int _DefaultAvailableUDPPort;
        /// <summary>
        /// 默认可用的UDP端口
        /// </summary>
        public static int DefaultAvailableUDPPort
        {
            get
            {
                if (_DefaultAvailableUDPPort == 0) return 5060;
                return _DefaultAvailableUDPPort;
            }
            set
            {
                _DefaultAvailableUDPPort = value;
            }
        }

        /// <summary>
        /// 用户的SIPID
        /// </summary>
        public static string UserSIPId { get; set; }
        
        private static string _UserSIPDisplayName;
        /// <summary>
        /// 用户显示的名称
        /// </summary>
        public static string UserSIPDisplayName
        {
            get
            {
                if (string.IsNullOrEmpty(_UserSIPDisplayName))
                    return UserSIPId;
                return _UserSIPDisplayName;
            }
            set { _UserSIPDisplayName = value; }
        }

        /// <summary>
        /// 用户要注册的密码
        /// </summary>
        public static string UserSIPPassword { get; set; }
        
        private static string _UserRegistServerIP;
        /// <summary>
        /// 要注册到的服务器地址
        /// </summary>
        public static string UserRegistServerIP
        {
            get
            {
                if (string.IsNullOrEmpty(_UserRegistServerIP))
                    throw new Exception("请先配置注册服务器IP地址！");
                return _UserRegistServerIP;
            }
            set { _UserRegistServerIP = value; }
        }
        
        public static int _CallReservedSeconds;
        /// <summary>
        /// 保持呼叫的时间（单位：S）
        /// </summary>
        public static int CallReservedSeconds
        {
            get
            {
                if (_CallReservedSeconds == 0)
                    return 60;
                return _CallReservedSeconds;
            }
            set { _CallReservedSeconds = value; }
        }

        private static string _ThreadName;
        public static string ThreadName
        {
            get
            {
                if (string.IsNullOrEmpty(_ThreadName))
                    _ThreadName = Assembly.GetEntryAssembly().FullName;
                return _ThreadName;
            }
            set { _ThreadName = value; }
        }
        
    }
}
